<?php
/**

 //  DoYouHaoBaby-X Ucenter ( DoYouHaoBaby-X 计划 )
 //  +---------------------------------------------------------------------
 //
 //  “Copyright”
 //  +---------------------------------------------------------------------
 //	 | (C) 2010 - 2011 http://doyouhaobaby.net All rights reserved.
 //	 | This is not a free software, use is subject to license terms
 //  +---------------------------------------------------------------------
 //
 //  “About This File”
 //  +---------------------------------------------------------------------
 //	 | Ucenter 节点分组控制器
 //  +---------------------------------------------------------------------

*/

!defined( 'DYHB_PATH' ) && exit;

class GroupController extends InitController{

	/**
	 * 数据查询条件过滤
	 */
    public function filter_( &$arrMap ){

		$arrMap['group_name'] = array( 'like',"%".Safe::getGpc( 'group_name' )."%" );
	}

    /**
     * 角色分组排序
     */
    public function sort( ){

		$nSortId = Safe::getGpc( 'sort_id','G' );

        if( !empty( $nSortId ) ) {

            $arrMap[ 'group_status' ] = 1;
            $arrMap[ 'group_id' ]   = array( 'in',$nSortId );
            $arrSortList   =   GroupModel::F()
                               ->order('group_sort ASC')
                               ->where( $arrMap )
                               ->asArray()
                               ->all()
                               ->query();
        }

        else{

            $arrSortList   = GroupModel::F()
                             ->order('group_sort ASC')
                             ->asArray()
                             ->all()
                             ->query();
        }

        $this->assign( "arrSortList",$arrSortList );
        $this->display();
    }

}
